home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / RGASM.RAR / ASMCODE.EXE / CHAPT8 / VIDTYP.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-05-10  |  3.7 KB  |  106 lines

  1. ;**********************************************************************
  2. ;
  3. ;  Program VidTyp ( Chapter 8 )
  4. ;
  5. ;  Screen I/O library system.  Version 1.0
  6. ;
  7. ;  The program for determining the video adapter type.
  8. ;
  9. ;  Author:  A.I.Sopin Voronezh,  1990 --- 1992 
  10. ;
  11. ;  Usage: Call  VIDTYP
  12. ;
  13. ;  Results:
  14. ;
  15. ;  AL    -Type of Videoadapter
  16. ;
  17. ;  AL =0 -MDA
  18. ;  AL =1 -CGA
  19. ;  AL =2 -MCGA
  20. ;  AL =3 -EGA
  21. ;  AL =4 -VGA
  22. ;
  23. ;  DX    -Video Segment Address (for text mode):
  24. ;
  25. ;  DX = 0B000h - if monochrome display  (MDA, EGA, VGA, MCGA)
  26. ;  DX = 0B800h - if color display       (CGA, EGA, VGA, MCGA)
  27. ;
  28. ;
  29. ;  For  EGA  only !!! :
  30. ;  --------------------
  31. ;
  32. ;  BH =0 -color display, BH=1 -monochrome display
  33. ;
  34. ;  BL    -memory installed on  EGA  board:
  35. ;
  36. ;  0     -if   64 KB
  37. ;  1     -if  128 KB
  38. ;  2     -if  192 KB
  39. ;  3     -if  256 KB
  40. ;
  41. ;  CH    -feature bits (see Notes)
  42. ;
  43. ;  CL    -switch setting (see Notes)
  44. ;
  45. ;**********************************************************************
  46. ;
  47. CODE    SEGMENT
  48.     ASSUME  CS:CODE
  49. VIDTYP  PROC    FAR
  50.     PUBLIC  VIDTYP
  51. ;----------------------------------------------------------
  52. CHKVGA: mov     ax,1A00h                ;  Request video info for VGA
  53.     int     10h                     ;  Get Display Combination Code
  54.     cmp     al,1Ah                  ;  Is VGA or MCGA present?
  55.     jne     CHKEGA                  ;  No?  Then check for EGA
  56.     cmp     bl,2                    ;  If VGA exists as secondary adapter,
  57.     je      CGA                     ;  check for CGA and mono as primary
  58.     jb      MONO                    ;
  59.     cmp     bl,5                    ;  If EGA is primary, do normal
  60.     jbe     CHKEGA                  ;  EGA checking
  61. ;
  62. CHKMCGA:mov     al,2                    ;  Yes? Assume MCGA
  63.     mov     dx,0B800h               ;  Segment for  Color
  64.     cmp     bl,8                    ;  Correct assumption?
  65.     jbe     VGA                     ;  VGA only (BL = 7 - 8)
  66. MCGA:   cmp     bl,0Bh                  ;  Monocrome Display ?
  67.     jne     EXIT                    ;  Return
  68.     mov     dx,0B000h               ;  Segment for Monochrome
  69.     jmp     short EXIT              ;  Return
  70. ;
  71. VGA:    mov     al,4                    ;  Assume it's VGA color
  72.     cmp     bl,8                    ;  VGA  Color ?
  73.     je      EXIT                    ;  Return
  74.     mov     dx,0B000h               ;  Segment for Monochrome
  75.     jmp     short EXIT              ;  Return
  76. ;
  77. CHKEGA: mov     ah,12h                  ;  Call EGA status function
  78.     mov     bl,10h                  ;  Get Configuration Information
  79.     sub     cx,cx                   ;  Clear status bits
  80.     int     10h                     ;  Get Configuration Information
  81.     jcxz    CHKCGA                  ;  If CX is unchanged, not EGA
  82. EGA:    mov     al,3                    ;  Set structure fields for EGA
  83.     mov     dx,0B800h               ;  Segment for  Color
  84.     and     bh,bh                   ;  Color Display ?
  85.     jz      EXIT                    ;  Yes, Return
  86.     mov     dx,0B000h               ;  Segment for Monochrome
  87.     jmp     short EXIT              ;  Return
  88. ;
  89. CHKCGA: xor     ax,ax                   ;
  90.     mov     es,ax                   ;  BIOS  segment
  91.     mov     ax,es:[410h]            ;  0:410 -equipment list
  92.     and     al,30h                  ;  If bits 4-5 set, monochrome
  93.     cmp     al,30h                  ;  Monochrome text mode?
  94.     je      MONO                    ;  Yes? Continue
  95. CGA:    mov     al,1                    ;  No?  Must be CGA
  96.     mov     dx,0B800h               ;  Segment for  Color
  97.     jmp     short EXIT              ;  Return
  98. MONO:   xor     al,al                   ;  Set MONO
  99.     mov     dx,0B000h               ;  Segment for  MONO
  100. ;----------------------------------------------------------
  101. ;  Finish program and return
  102. EXIT:   RETF
  103. VIDTYP  ENDP
  104. CODE    ENDS
  105.     END
  106.